package com.huanqiu.mylib.util;

import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;

public final class GsonUtil {

    public static String toJson(Object obj) {
        Gson gson = new Gson();
        return gson.toJson(obj);
    }

    public static <T> T toObject(String json, Class<T> clazz) throws JsonSyntaxException {
        Gson gson = new Gson();
        return gson.fromJson(json, clazz);
    }

}
